<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/7/7
 * Time: 17:05
 * Project name: PHPTEST
 * File name: 2.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since 1.0.0
 */

try {
	$redis = new Redis();
	$redis->connect( "localhost", 6379 );
} catch ( RedisException $redisException ) {
	echo "----------------------";
	throw new RedisException();
} finally {
	$redis->connect( "localhost", 6379 );
	echo $redis->ping();
//	var_dump( $redis->client( "LIST" ) );

	var_dump($redis->time());
	if($redis->exists("test")){
		echo $redis->get("test");
		$redis->append("test",__FILE__);
	}else{
		$redis->set("test","this is a test text\n");
	}

	echo $redis->get("test");

	$redis->select(1);
	$redis->set("test2","test2");


	$redis->close();
}
